PROJ_04

DIGITAL WALLET
BACKEND SYSTEM

Secure wallet backend supporting peer-to-peer fund transfers, transaction history management, user authentication and concurrent transaction processing.

JAVA SPRING BOOT MYSQL JUNIT 5 MOCKITO

OVERVIEW

The Digital Wallet Backend System was designed to support secure peer-to-peer money transfers while maintaining transaction consistency and reliability. The application provides wallet creation, balance management, transaction history and transfer functionality using Spring Boot and MySQL. Comprehensive testing was implemented using JUnit 5 and Mockito to validate critical wallet operations.

ARCHITECTURE


+----------------------+
|      USER APP        |
+----------+-----------+
           |
           v

+----------------------+
|   SPRING BOOT API    |
+----------+-----------+
           |
           v

+----------------------+
| AUTHENTICATION       |
+----------+-----------+
           |
           v

+----------------------+
| WALLET SERVICE       |
+----------+-----------+
           |
           v

+----------------------+
| TRANSACTION SERVICE  |
+----------+-----------+
           |
           v

+----------------------+
|       MYSQL          |
+----------------------+

TRANSFER_FLOW

  1. 1. User initiates transfer request.
  2. 2. Sender wallet balance validated.
  3. 3. Transaction created.
  4. 4. Sender balance debited.
  5. 5. Receiver balance credited.
  6. 6. Transaction committed.
  7. 7. History updated.

KEY_FEATURES

Wallet Management

Create wallets and manage balances securely through REST APIs.

P2P Transfers

Transfer funds between wallets with transactional guarantees.

Transaction History

Complete transaction audit trail for every wallet.

Automated Testing

JUnit and Mockito based unit tests validating critical flows.

DATABASE_DESIGN


USERS
 ├── id
 ├── name
 └── email

WALLETS
 ├── id
 ├── user_id
 └── balance

TRANSACTIONS
 ├── id
 ├── sender_wallet
 ├── receiver_wallet
 ├── amount
 └── created_at

TRANSACTION_MANAGEMENT

Wallet transfers are executed within a database transaction to ensure atomicity. Either both balance updates succeed or the entire transfer is rolled back. This guarantees consistency and prevents partial transfers.

SECURITY_FEATURES

Validation

Request validation before processing.

Balance Checks

Prevents overdraft transactions.

ACID Transactions

Ensures consistency of wallet data.

ENGINEERING_CHALLENGES

Concurrent Transfers

Multiple users may attempt transactions simultaneously. The system uses transactional guarantees to prevent inconsistent balances.

Data Consistency

A transfer involves multiple database updates. Atomic transactions ensure both debit and credit operations succeed together.

Transaction History

Every wallet operation is recorded, providing a complete audit trail for users and administrators.

TESTING_STRATEGY

JUnit 5

Unit testing of business logic.

Mockito

Mocking dependencies and services.

Validation Tests

Transfer and balance verification.

PROJECT_RESULTS

ACID

TRANSACTION SAFETY

P2P

FUND TRANSFERS

JUNIT

TEST COVERAGE

LESSONS_LEARNED

This project strengthened my understanding of transactional systems, database consistency, service-layer architecture and automated testing. Building the wallet backend provided practical experience with Spring Boot, MySQL, JUnit 5, Mockito and enterprise backend development practices.

VIEW_SOURCE_CODE

Explore the wallet service implementation, transaction management and testing strategy.

OPEN_GITHUB